Naviguide: Fix handling of negative ICS eastings and northings.
authortsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 13 Dec 2012 01:04:03 +0000 (01:04 +0000)
committertsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 13 Dec 2012 01:04:03 +0000 (01:04 +0000)
gpsbabel/naviguide.c
gpsbabel/reference/ics.gpx [new file with mode: 0644]
gpsbabel/reference/ics.gpx.naviguide.gpx [new file with mode: 0644]
gpsbabel/reference/track/trackfilter_discard.gpx [changed mode: 0755->0644]
gpsbabel/testo.d/classic-4.test

index 5bebab6640b7a23bda540ad8648a62631104a153..3f28f9973e77df92daa44fd48d09db5358d9f182 100644 (file)
@@ -47,8 +47,8 @@ typedef struct {
 typedef struct {
   unsigned char pad1[8];   /*  0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 */
   /* coordination are in old israeli grid */
-  gbuint32 East;
-  gbuint32 North;
+  gbint32 East;
+  gbint32 North;
   unsigned char pad2[2];  /* 0x01, 0x01 */
   gbuint32 Alt;
   char CommentLength;
@@ -252,8 +252,8 @@ ng_waypt_rd(const waypoint* wpt)
     fatal(MYNAME ": Waypoint %d is out of the israeli grid area", current_wp_ix);
   }
 
-  WPNC.wp_data.North = (gbuint32)lat;
-  WPNC.wp_data.East = (gbuint32)lon;
+  WPNC.wp_data.North = (gbint32)lat;
+  WPNC.wp_data.East = (gbint32)lon;
 
   if (reorder_wp) {
     sprintf(temp_short_name, "A%03d", current_wp_ix);
diff --git a/gpsbabel/reference/ics.gpx b/gpsbabel/reference/ics.gpx
new file mode 100644 (file)
index 0000000..4b84c0e
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>\r
+<gpx\r
+ version="1.1"\r
+ creator="tsteven4"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xmlns="http://www.topografix.com/GPX/1/1"\r
+ xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">\r
+<!-- These points walk around 0 Easting 0 Northing to find sign problems. -->\r
+<wpt lat="22.556257" lon="32.568393">\r
+<name>1</name>\r
+</wpt>\r
+<wpt lat="22.556257" lon="34.568393">\r
+<name>2</name>\r
+</wpt>\r
+<wpt lat="20.556257" lon="34.568393">\r
+<name>3</name>\r
+</wpt>\r
+<wpt lat="20.556257" lon="32.568393">\r
+<name>4</name>\r
+</wpt>\r
+</gpx>\r
diff --git a/gpsbabel/reference/ics.gpx.naviguide.gpx b/gpsbabel/reference/ics.gpx.naviguide.gpx
new file mode 100644 (file)
index 0000000..c0d21d9
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx
+  version="1.0"
+  creator="GPSBabel - http://www.gpsbabel.org"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns="http://www.topografix.com/GPX/1/0"
+  xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
+<time>1970-01-01T00:00:00Z</time>
+<bounds minlat="20.556257939" minlon="32.568395522" maxlat="22.556254099" maxlon="34.568387647"/>
+<rte>
+  <rtept lat="22.556250760" lon="32.568395669">
+    <ele>0.000000</ele>
+    <name>1</name>
+    <cmt>1</cmt>
+    <desc>1</desc>
+  </rtept>
+  <rtept lat="22.556254099" lon="34.568387354">
+    <ele>0.000000</ele>
+    <name>2</name>
+    <cmt>2</cmt>
+    <desc>2</desc>
+  </rtept>
+  <rtept lat="20.556260799" lon="34.568387647">
+    <ele>0.000000</ele>
+    <name>3</name>
+    <cmt>3</cmt>
+    <desc>3</desc>
+  </rtept>
+  <rtept lat="20.556257939" lon="32.568395522">
+    <ele>0.000000</ele>
+    <name>4</name>
+    <cmt>4</cmt>
+    <desc>4</desc>
+  </rtept>
+</rte>
+</gpx>
index 2c4ef6a754c1b0ee531535ed06621ef6b507ad3a..e2fb43194bbbbc6d81248db03147da63bd632de0 100755 (executable)
@@ -302,6 +302,10 @@ compare ${REFERENCE}/v900_advanced_mode.gpx ${TMPDIR}/v900_advanced_mode.gpx
 #
 gpsbabel -i naviguide -f ${REFERENCE}/route/naviguide-route.twl -o gpx -F ${TMPDIR}/naviguide.gpx
 compare ${REFERENCE}/route/naviguide.gpx ${TMPDIR}/naviguide.gpx
+# Make sure ICS negative eastings and northings work.
+gpsbabel -i gpx -f ${REFERENCE}/ics.gpx -o naviguide -F ${TMPDIR}/ics.gpx.naviguide
+gpsbabel -i naviguide -f ${TMPDIR}/ics.gpx.naviguide -o gpx -F ${TMPDIR}/ics.gpx.naviguide.gpx
+compare ${REFERENCE}/ics.gpx.naviguide.gpx ${TMPDIR}/ics.gpx.naviguide.gpx
 
 #
 # Basic VPL test